package com.imonsoft.sqm.dao.business.ipic_system;

import java.util.List;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
import org.springframework.stereotype.Repository;

import com.imonsoft.common.httpModel.DataGrid;
import com.imonsoft.common.httpModel.Pager;
import com.imonsoft.sqm.pojo.business.ipic_system.Claim;
import com.imonsoft.sqm.pojo.business.ipic_system.ClaimExample;

@SuppressWarnings("deprecation")
@Repository("claimDAO")
public class ClaimDAOImpl extends SqlMapClientDaoSupport implements ClaimDAO {

	/**
	 * This method was generated by Apache iBATIS ibator. This method corresponds to the database table tt_claim
	 * @ibatorgenerated  Mon Jun 03 13:19:37 CST 2013
	 */
	public ClaimDAOImpl() {
		super();
	}

	/**
	 * This method was generated by Apache iBATIS ibator. This method corresponds to the database table tt_claim
	 * @ibatorgenerated  Mon Jun 03 13:19:37 CST 2013
	 */
	public int countClaimByExample(ClaimExample example) {
		Integer count = (Integer) getSqlMapClientTemplate().queryForObject(
				"tt_claim.ibatorgenerated_countByExample", example);
		return count;
	}

	/**
	 * This method was generated by Apache iBATIS ibator. This method corresponds to the database table tt_claim
	 * @ibatorgenerated  Mon Jun 03 13:19:37 CST 2013
	 */
	public int deleteClaimByExample(ClaimExample example) {
		int rows = getSqlMapClientTemplate().delete(
				"tt_claim.ibatorgenerated_deleteByExample", example);
		return rows;
	}

	/**
	 * This method was generated by Apache iBATIS ibator. This method corresponds to the database table tt_claim
	 * @ibatorgenerated  Mon Jun 03 13:19:37 CST 2013
	 */
	public int deleteClaimByPrimaryKey(Long id) {
		Claim key = new Claim();
		key.setId(id);
		int rows = getSqlMapClientTemplate().delete(
				"tt_claim.ibatorgenerated_deleteByPrimaryKey", key);
		return rows;
	}

	/**
	 * This method was generated by Apache iBATIS ibator. This method corresponds to the database table tt_claim
	 * @ibatorgenerated  Mon Jun 03 13:19:37 CST 2013
	 */
	public Long insertClaim(Claim record) {
		Object newKey = getSqlMapClientTemplate().insert(
				"tt_claim.ibatorgenerated_insert", record);
		return (Long) newKey;
	}

	/**
	 * This method was generated by Apache iBATIS ibator. This method corresponds to the database table tt_claim
	 * @ibatorgenerated  Mon Jun 03 13:19:37 CST 2013
	 */
	public Long insertClaimSelective(Claim record) {
		Object newKey = getSqlMapClientTemplate().insert(
				"tt_claim.ibatorgenerated_insertSelective", record);
		return (Long) newKey;
	}

	/**
	 * This method was generated by Apache iBATIS ibator. This method corresponds to the database table tt_claim
	 * @ibatorgenerated  Mon Jun 03 13:19:37 CST 2013
	 */
	@SuppressWarnings("unchecked")
	public List<Claim> selectClaimByExample(ClaimExample example) {
		List<Claim> list = getSqlMapClientTemplate().queryForList(
				"tt_claim.ibatorgenerated_selectByExample", example);
		return list;
	}

	/**
	 * This method was generated by Apache iBATIS ibator. This method corresponds to the database table tt_claim
	 * @ibatorgenerated  Mon Jun 03 13:19:37 CST 2013
	 */
	public Claim selectClaimByPrimaryKey(Long id) {
		Claim key = new Claim();
		key.setId(id);
		Claim record = (Claim) getSqlMapClientTemplate().queryForObject(
				"tt_claim.ibatorgenerated_selectByPrimaryKey", key);
		return record;
	}

	/**
	 * This method was generated by Apache iBATIS ibator. This method corresponds to the database table tt_claim
	 * @ibatorgenerated  Mon Jun 03 13:19:37 CST 2013
	 */
	public int updateClaimByExampleSelective(Claim record, ClaimExample example) {
		UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
		int rows = getSqlMapClientTemplate().update(
				"tt_claim.ibatorgenerated_updateByExampleSelective", parms);
		return rows;
	}

	/**
	 * This method was generated by Apache iBATIS ibator. This method corresponds to the database table tt_claim
	 * @ibatorgenerated  Mon Jun 03 13:19:37 CST 2013
	 */
	public int updateClaimByExample(Claim record, ClaimExample example) {
		UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
		int rows = getSqlMapClientTemplate().update(
				"tt_claim.ibatorgenerated_updateByExample", parms);
		return rows;
	}

	/**
	 * This method was generated by Apache iBATIS ibator. This method corresponds to the database table tt_claim
	 * @ibatorgenerated  Mon Jun 03 13:19:37 CST 2013
	 */
	public int updateClaimByPrimaryKeySelective(Claim record) {
		int rows = getSqlMapClientTemplate().update(
				"tt_claim.ibatorgenerated_updateByPrimaryKeySelective", record);
		return rows;
	}

	/**
	 * This method was generated by Apache iBATIS ibator. This method corresponds to the database table tt_claim
	 * @ibatorgenerated  Mon Jun 03 13:19:37 CST 2013
	 */
	public int updateClaimByPrimaryKey(Claim record) {
		int rows = getSqlMapClientTemplate().update(
				"tt_claim.ibatorgenerated_updateByPrimaryKey", record);
		return rows;
	}

	/**
	 * This class was generated by Apache iBATIS ibator. This class corresponds to the database table tt_claim
	 * @ibatorgenerated  Mon Jun 03 13:19:37 CST 2013
	 */
	private static class UpdateByExampleParms extends ClaimExample {
		private Object record;

		public UpdateByExampleParms(Object record, ClaimExample example) {
			super(example);
			this.record = record;
		}

		@SuppressWarnings("unused")
		public Object getRecord() {
			return record;
		}
	}

	@SuppressWarnings("unchecked")
	@Override
	public DataGrid<Claim> getDataGrid(ClaimExample example, Pager pager) {
		if (example == null) {
			example = new ClaimExample();
		}
		int total = countClaimByExample(example);
		List<Claim> rows = getSqlMapClientTemplate().queryForList("tt_claim.ibatorgenerated_selectByExample", example, pager.getSkipResults(), pager.getRows());
		DataGrid<Claim> dataGrid = new DataGrid<Claim>(total, rows);
		return dataGrid;
	}

}